home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.19950528-19950726
/
000080_news@columbia.edu_Wed Jun 7 15:20:31 1995.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
4KB
Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA14957
(5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Wed, 7 Jun 1995 11:20:39 -0400
Received: by apakabar.cc.columbia.edu id AA12736
(5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Wed, 7 Jun 1995 11:20:37 -0400
Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: Kermit as data-entry clerk
Date: 7 Jun 1995 15:20:31 GMT
Organization: Columbia University, New York City
Lines: 87
Message-Id: <3r4g3v$cdr@apakabar.cc.columbia.edu>
References: <3r2avh$cdm@cmhcsys.cmhcsys.com>
Nntp-Posting-Host: watsun.cc.columbia.edu
Keywords: kermit variables
Apparently-To: kermit.misc@watsun.cc.columbia.edu
In article <3r2avh$cdm@cmhcsys.cmhcsys.com>,
Chuck Stickelman <chuck@cmhcsys.com> wrote:
: We have a customer how needs to get information from our proprietary
: database into a county-wide system. Unfortunately, the county-wide
: system does not allow batch transfers of any kind. Therefore, the
: customer has been paying a full-time employee to run a couple of
: reports on our system and then re-key the data into the other database.
: Needless to say, this is less than ideal.
:
: I proposed that we output the data to a DOS file in a format Kermit
: would like: {field data }{more field data }{even more...} etc.
: No problem. Then I thought we could use Kermit's 'read', 'assign'
: and 'output' commands to fake the remote system into thinking a real
: -live human was on the other end. Something like:
:
: define parse assign \%a \%1, assign \%b \%2, assign \%c \%3, ...
: open somefile.dat
: read \%z
: parse \%z
: output \%a
: output \%b
: output \%c
: ...
:
: However, the records in somefile.dat have too many fields (>35 in one
: instance) and I'm running out of both temporary and permanent variables.
: I've read the relevant pages in "Using MS-KERMIT" and understand that
: there are 10 temporary variables (0-9) and 26 permanent variables (a-z),
: but wonder if there's anyway I can "easily" change that or get around
: those limitations!?
:
Yes, there are many ways to do this. First, two observations:
1. If you are providing Kermit software to your customers, you have to
obtain written permission from the Office of Kermit Development and
Distribution at Columbia University. Email to kermit@columbia.edu
for further information.
2. You'll need version 3.14.
So you are saying that you can't do the obvious thing, namely:
open somefile.dat
:loop read \%z
if fail goto done
output \%z ; or "output \%z\13", etc, ...
goto loop
:done
In other words, you have to send one "word" at a time? One solution
that suggests itself immediately is to create the original file in a
different format, e.g. one field per line. You just have to think up
some convention for distinguishing between a field boundary and a record
boundary. (It's not clear to me from your description how you were
doing this in the first place -- I don't see any kind of field or record
delimiters in your example.)
MS-DOS Kermit 3.14 includes a full complement of string manipulation
functions -- index, substring, replace, etc, that you should be able to
use creatively to solve your problem. For example (assuming fields are
delimited by a single space):
:RECORDS
read \%a ; read a record
if fail goto done ; no more, we're finished
:FIELDS
assign \%j \flength(\%a) ; length of record
if > \%j 0 goto gotfield ; no (more) fields, get another
output ??? ; send your record delimiter here
goto records ; go get next record
:GOTFIELD
assign \%i \findex({ },\%a,1) ; got record, find first space
decrement \%i
if < \%i 1 asg \%i \%j ; no spaces, must be last field
assign \%f \fsubstr(\%a,1,\%i) ; get the field
output \%f ; send it (and add field delimiter)
increment \%i 2 ; point past it
assign \%a \fsubstr(\%a,\%i) ; and go get next field
goto fields
:DONE
See KERMIT.UPD for more info about string functions.
- Frank